﻿function selectstzd(contextPath, callback,ck,more,closedlg){
	var maps = [];
	var dlg = $('#dlg-selectstzd');
	if (!dlg.length){
		dlg = $('<div id="dlg-selectstzd">' +
				
'<div id="dlg-selectstzd-layout" class="easyui-layout" fit="true" >'+
'		<div data-options="region:\'north\'" style="height:40px;padding:5px;">'+
'		'+
'			<input type="text" class="easyui-validatebox e-input" id="et-input"  oninput="selectstzd.getAjaxdata('+contextPath+');" onpropertychange="selectstzd.getAjaxdata('+contextPath+');" style="width:350px;"  /></input>'+
'	  '+
'	  '+
'			<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-back" plain="true" onclick="selectstzd.backData(\'#et-input\','+contextPath+');">退格</a>'+
'			<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-cancel" plain="true" onclick="selectstzd.clearData(\'#et-input\','+contextPath+');">清除</a>'+
'		'+
'		</div>'+
'		<div data-options="region:\'east\'"  style="width:180px;overflow:hidden">'+
'		<select id="zdlist" size=30  name="zdlist" style="width:180px;" ondblclick="selectstzd.listdblClick();"'+
'			'+
'			>'+
'		'+
'	  </select>	'+
'		</div>'+
''+
'		<div data-options="region:\'center\'" border="false">'+
'			    <div class="easyui-layout" fit="true">'+
'			    	     <div data-options="region:\'south\'" style="height:80px;" >'+
'			    	     	     <div class="easyui-layout" fit="true">'+
'			    	     	         <div data-options="region:\'south\'" style="height:40px;padding:5px;" >'+
'			    	     	         	<input type="text" class="easyui-validatebox e-input" id="et-select"  style="width:400px;"  ></input>'+
'			    	             <a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-cancel" plain="true" onclick="selectstzd.clear();">清除</a>'+
'			    	               </div>	'+
'			    	               <div data-options="region:\'center\'" style="padding:5px;">'+
'			    	               	   选择内容：<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" onclick="javascript:selectstzd.inputData(\'#et-select\',\'与\');">与</a>'+
'			    	               	   <a href="javascript:void(0);" class="easyui-linkbutton" plain="true" onclick="javascript:selectstzd.inputData(\'#et-select\',\'交界\');">交界</a>'+
'			    	               	   <a href="javascript:void(0);" class="easyui-linkbutton" plain="true" onclick="javascript:selectstzd.inputData(\'#et-select\',\'对面\');">对面</a>'+
'			    	               	   <a href="javascript:void(0);" class="easyui-linkbutton" plain="true" onclick="javascript:selectstzd.inputData(\'#et-select\',\'附近\');">附近</a>'+
'			    	               	   <a href="javascript:void(0);" class="easyui-linkbutton" plain="true" onclick="javascript:selectstzd.inputData(\'#et-select\',\'段\');">段</a>'+
'			    	               	   <a href="javascript:void(0);" class="easyui-linkbutton" plain="true" onclick="javascript:selectstzd.inputData(\'#et-select\',\'铺面\');">铺面</a>'+
'			    	               	   <a href="javascript:void(0);" class="easyui-linkbutton" plain="true" onclick="javascript:selectstzd.inputData(\'#et-select\',\'宿舍\');">宿舍</a>'+
'			    	               </div>'+
'			    	     	     </div>	 '+
'			    	     	'+
'			    	     </div>'+
'			    	     <div data-options="region:\'center\'" >'+
'			    	         '+
'			    	         <div class="easyui-layout" fit="true">'+
'			    	         <div data-options="region:\'west\'" style="width:240px;padding:5px;overflow:hidden" border="false">'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-a\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'A\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-b\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'B\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-c\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'C\','+contextPath+');" ></a>'+
'			    	         	'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-h\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'H\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-i\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'I\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-j\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'J\','+contextPath+');" ></a>'+
'			    	         	'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-o\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'O\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-p\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'P\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-q\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'Q\','+contextPath+');" ></a>'+
'			    	         	'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-u\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'U\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-v\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'V\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-w\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'W\','+contextPath+');" ></a>'+
'			    	         	'+
'			    	         </div>'+
'			    	         <div data-options="region:\'center\'" style="padding:5px;overflow:hidden" border="false">'+
'			    	        	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-d\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'D\','+contextPath+');" ></a>'+
'                      <a  class="easyui-squarebutton"  data-options="iconCls:\'icon-k\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'K\','+contextPath+');" ></a>			    	     	'+
'			    	         </div>'+
'			    	         <div data-options="region:\'east\'" style="width:240px;padding:5px;overflow:hidden" border="false">'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-e\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'E\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-f\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'F\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-g\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'G\','+contextPath+');" ></a>'+
'			    	         	'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-l\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'L\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-m\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'M\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-n\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'N\','+contextPath+');" ></a>'+
'			    	         	'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-r\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'R\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-s\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'S\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-t\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'T\','+contextPath+');" ></a>'+
'			    	         	'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-x\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'X\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-y\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'Y\','+contextPath+');" ></a>'+
'			    	         	<a  class="easyui-squarebutton"  data-options="iconCls:\'icon-z\',large:true" href="javascript:selectstzd.inputData(\'#et-input\',\'Z\','+contextPath+');" ></a>'+
'			    	         </div>'+
'			    	             '+
'		                 </div>'+
'			    	          	'+
'			    	     	'+
'			    	     </div>'+
'			    	     '+
'		      </div>				'+
'		</div>'+
'	</div>'	).appendTo('body');



			dlg.dialog({
				title:'选择楼盘字典',
				width:760,
				height:475,
				modal:true,
				buttons:[{
					text:'确定',
					iconCls:'icon-ok',
					handler:function(){
						dlg.dialog('close');
						if (callback){
							selectstzd.stzd = $('#et-select').val();	
							
							callback(selectstzd.stzd);
						}
					}
				},{
					text:'取消',
					iconCls:'icon-cancel',
					handler:function(){dlg.dialog('close');}
				}]
			});
			$('.easyui-layout').layout();
			$('.easyui-linkbutton').linkbutton();
			$('.easyui-squarebutton').squarebutton();
			
			
	$('#et-select').val(ck);
	selectstzd.stzd = ck;

	
	} else {
		
		dlg.dialog({
			title:'选择楼盘字典',
			width:740,
			height:475,
			modal:true,
			buttons:[{
				text:'确定',
				iconCls:'icon-ok',
				handler:function(){
					dlg.dialog('close');
					if (callback){
						selectstzd.stzd = $('#et-select').val();
						
						callback(selectstzd.stzd);
					}
				}
			},{
				text:'取消',
				iconCls:'icon-cancel',
				handler:function(){dlg.dialog('close');}
			}]
		});
		dlg.dialog('open');
		$('#et-select').val(ck);

		
	}
	
	selectstzd.stzd = ck;

	
}

selectstzd.stzd = '';


selectstzd.clear = function(){
	selectstzd.stzd = '';
	$('#et-select').val('');
};


selectstzd.listdblClick = function() {
   var selectText = $('#zdlist').find('option:selected').text(); 
   if (selectText) selectstzd.inputData('#et-select',selectText);
}

selectstzd.inputData = function(obj,data,contextPath){    
	$(obj).val($(obj).val() + data);
	if (obj == '#et-input') selectstzd.getAjaxdata(contextPath);
	
	}

selectstzd.backData = function(obj,contextPath){
	
   $(obj).val($(obj).val().substring(0,$(obj).val().length-1));
   if (obj == '#et-input') selectstzd.getAjaxdata(contextPath);
}


selectstzd.clearData = function(obj,contextPath){    
	$(obj).val('');
	if (obj == '#et-input') selectstzd.getAjaxdata(contextPath);
}

selectstzd.getAjaxdata =function(contextPath){
  
	$.ajax({
		url: contextPath + 'myinfo/esinfo/getStzd?ids=' + $('#et-input').val(),
		type:'post',
		success:function(data){
			
			  $('#zdlist').empty();
			  
			  for (var one in data)
			    {
			        for(var key in data[one])
			        {
			           
			            var msg = '<option value="'+data[one][key]+'">'+data[one][key]+'</option>';
			            $('#zdlist').append(msg);
			        }
			    }
			  
		}
	});  
  
	
}


